package com.campus.campusdelivery.constant;

public enum MerchantStatus {
    PENDING("PENDING", "待审核"),
    APPROVED("APPROVED", "已通过"),
    REJECTED("REJECTED", "已拒绝"),
    SUSPENDED("SUSPENDED", "已暂停"),
    CLOSED("CLOSED", "已关闭");

    private final String code;
    private final String description;

    MerchantStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static MerchantStatus fromCode(String code) {
        for (MerchantStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown merchant status code: " + code);
    }
}
